engines


Auto.js Pro 9 Docs / engines

engines

The engines module provides methods to get the current engine, arguments, and configuration of current engine, and functions to get other engines, start new engines, control other engines, and communicate with other engines.

Table of contents

Interfaces

Functions

Functions

broadcast

broadcast(event, ...args): void

Send a broadcast to all engines. It is equivalent to sending the same event to all engines.

Parameters

NameTypeDescription
eventstringEvent name
...argsany[]Event arguments, must be serializable (can be converted to JSON)

Returns

void


execScriptFile

execScriptFile(file, config?): ScriptExecution

Start a new engine to run a script or a project. The script context and environment will be independent from the current context and environment. The script can communicate with other scripts by events or broadcasts.

Parameters

NameTypeDescription
filestringScript or project path
config?ExecutionConfigExecution configuration

Returns

ScriptExecution

Script execution object. It can be used to get engine status, communicate with other scripts, and control the engine.


getRunningEngines

getRunningEngines(): ScriptEngine[]

Get all current running engines.

Returns

ScriptEngine[]

Array of current running engines


myEngine

myEngine(): SelfScriptEngine

Get the engine object of the engine that current script running with.

Returns

SelfScriptEngine


stopAll

stopAll(options?): void

Stop all engines.

Parameters

NameTypeDescription
options?StopAllOptions停止所有引擎的选项

Returns

void